
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.ensemble import GradientBoostingRegressor

# 1、读取作者特征.csv文件, 提取特征变量和目标变量。
df = pd.read_csv('vedio_dataset.csv')
print(df.head(10))
print(df.info())

X = df.drop({'real_time','date','like'},axis=1)
y = df['like']


# 2、将数据拆分成训练集和测试集。

X_train, X_test, y_train, y_test = train_test_split(X[:1000], y[:1000], test_size=0.7, random_state=42)


# 3、构建GBDT回归模型，预测用户总点赞量预测。
reg = GradientBoostingRegressor(random_state=0)
reg.fit(X_train, y_train)

# 4、对模型模型预测效果评估。
r4 = reg.score(X_test,y_test)
print(r4)


